const Router = require('koa-router')
const mongoose = require('mongoose')
const router = new Router()

router.get('/getBannerList', async ctx => {
  try {
    const Banner = require('../database/schema/Banner')
    let result = await Banner.find().exec()
    ctx.body = {
      code: 200,
      data: result,
      message: 'ok'
    }
  } catch (error) {
    ctx.body = {
      code: 500,
      message: error
    }
  }
})

router.get('/getMallList', async ctx => {
  try {
    const Malls = require('../database/schema/Malls')
    let result = await Malls.find().exec()
    ctx.body = {
      code: 200,
      data: result,
      message: 'ok'
    }
  } catch (error) {
    ctx.body = {
      code: 500,
      message: error
    }
  }
})

module.exports = router